
package com.glela.common.aspect;

import org.aspectj.lang.JoinPoint;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Before;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.springframework.stereotype.Component;

import com.glela.common.service.impl.AbstractBaseService;

/**
 * 
 * @author liujie
 * @date 2016年4月15日
 *	
 */
@Aspect
@Component
public class InitDaoAspect {
	
	private static final Logger logger = LoggerFactory.getLogger(InitDaoAspect.class);
			
	@Before("execution(public * com.glela.*.service.IBaseService.*(..)) and !execution(public * com.glela.*.service.IBaseService.initBaseDao(..))")  
	public void  doBefore(JoinPoint pjp){
		try {
			AbstractBaseService<?> abstractBaseService=(AbstractBaseService<?>)pjp.getTarget();
			abstractBaseService.initBaseDao();
		} catch (Throwable e) {
			logger.error(e.getMessage(),e);
		}
	}
}
